package view.Arm.tank
{
	import data.Globals;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.geom.Point;
	import flash.utils.getTimer;
	import flash.utils.setTimeout;
	
	import utils.GameUtils;
	
	import view.Arm.BaseTank;

	/**
	 *@author CrazyChen
	 *2013-6-17
	 *public class ETank extends BaseTank
	 *import view.Arm.BaseTank;
	 
	 */
	public class ETank extends BaseTank
	{
		public function ETank()
		{
			cls= GameUtils.getClsFromDomain("ui.ria.Karl");
			super();
			(disObj as MovieClip).stop();
		}
		
		override protected function shout():void{
			var isShoot:Boolean;
			if(preTime){
				var curUse:Number = getTimer() - preTime;
				if(curUse > shoutGap){
					preTime = getTimer();
					isShoot = true;
				}
			}else{
				preTime = getTimer();
				isShoot = true;
			}
			if(isShoot){
				(disObj as MovieClip).gotoAndPlay('fire');
			    setTimeout(shoutHandle,300);
			}
		
		}
		
		private function shoutHandle():void{
			if(!shoutTarget)return;
			Globals.gameView.shoutBullet(bulletType,new Point(this.x,this.y),new Point(shoutTarget.x,shoutTarget.y),null,0,-30,shoutTarget);
		}
		
		override protected function loop(event:Event):void{
		    super.loop(event);
			if((disObj as MovieClip).currentFrame == 1)(disObj as MovieClip).stop();
		}
	}
}